package com.ipay.wechat.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ipay.utils.Query;
import com.ipay.wechat.dao.QRCodeDao;
import com.ipay.wechat.pojo.QRCode;
import com.ipay.wechat.service.QRCodeService;

@Service("codeService")
public class QRCodeServiceImpl implements QRCodeService {
	@Autowired 
	private QRCodeDao codeDao;

	@Override
	public List<QRCode> findQRCode(QRCode code) {
		return codeDao.findQRCode(code);
	}
	@Override
	public List<QRCode> queryQRCodeList(QRCode code) {
		return codeDao.queryQRCodeList(code);
	}
	@Override
	public List<QRCode> findQRCodeByUserId(Long userId,String merchantNo){
		QRCode code=new QRCode();
		code.setUserId(userId);
		code.setMerchantId(merchantNo);
		return codeDao.findQRCodeByUserId(code);
	}

	@Override
	public List<QRCode> queryList(Query query) {
		// TODO Auto-generated method stub
		return codeDao.queryList(query);
	}

	@Override
	public int queryTotal(Query query) {
		// TODO Auto-generated method stub
		return codeDao.queryTotal(query);
	}

	@Override
	public void modifyCode(String codeNo, String code_name) {
		// TODO Auto-generated method stub
		QRCode code=new QRCode();
		code.setCodeName(code_name);
		code.setCodeNo(codeNo);
		codeDao.modifyCode(code);
		
	}
	
	@Override
	public void updateQrCode(String codeNo,String deleteStatus){
		QRCode code=new QRCode();
		code.setCodeNo(codeNo);
		code.setDeleteStatus(deleteStatus);
		codeDao.modifyCode(code);
		
	}
	@Override
	public QRCode findCodeDetailsByCodeno(String codeNo) {
		// TODO Auto-generated method stub
		return codeDao.findCodeDetailsByCodeno(codeNo);
	}
	@Override
	public QRCode findCodeDetails(QRCode code) {
		// TODO Auto-generated method stub
		return codeDao.findCodeDetails(code);
	}
	@Override
	public QRCode findQRCodeByCodeno(String codeNo) {
		return codeDao.findQRCodeByCodeno(codeNo);
	}

	@Override
	public void insertQrCode(QRCode qRCode) {
		qRCode.setCodeStatus("1");		  //二维码状态
		codeDao.insertQrCode(qRCode);
	}
}
